<template>
	<view class="page">
		<div class="weui-search-bar" style="position: relative; ">
			 <i class="weui-icon-search"></i>
		<input type="search" class="search-input pbt4" id='search' placeholder='请输入活动名称关键字....'/><button  class="weui-btn weui-btn_mini" ><span class="iconfont icon-wodedangxuan-copy f-green "></span></button>
		</div>
		<!-- 搜索end -->
		<div class="weui-panel__bd sc-xyfc">
			<navigator :url="'/pages/vote/index?id='+vote.id" v-for="(vote,index) in votes" :key="vote.id" class="weui-media-box weui-media-box_appmsg">	
				<div class="weui-media-box__hd">
					<img class="weui-media-box__thumb" :src="vote.posterPath" alt="">
					<span class="sc-mark-rt" :class="vote.voteState=='已结束'?'bg-hui':'bg-green'">{{vote.voteState}}</span>
				</div>
				<div class="weui-media-box__bd">
					<h4 class="weui-media-box__title">{{vote.voteName}}</h4>
					<p class="weui-media-box__desc"><span class="iconfont icon-qizhi"></span> {{vote.orgName}}</p>
					<p class="weui-media-box__desc"><span class="iconfont icon-lishi"></span> {{vote.voteTimeEnd}} 投票截止</p>
					<p class="weui-media-box__desc f-green"><span class="iconfont icon-toupiao1"></span> 总票数：{{vote.voteNumAlready}}票</p>
				</div>
			</navigator>
		</div>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				votes: []
			}
		},
		onLoad() {
			this.getList();
		},
		methods: {
			getList() {
				let _self = this;
				this.$get(this.$api.voteList, {}).then(res => {
					if (res.code == 0) {
						_self.votes = res.votes;
					} else {
						uni.showModal({
							title: '操作提示',
							content: res.msg,
							showCancel: false
						})
					}
				})
			}
		}
	}
</script>

<style>

</style>
